package cn.hanyx.coder.design.pattern.behavioral.state.demo03.state;

import cn.hanyx.coder.design.pattern.behavioral.state.demo03.MarioStateMachine;

/**
 * SmallMario
 *
 * @author hanyx
 * @date 2020/06/08
 */
public class SmallMario implements IMario {

    private SmallMario() {
    }

    private static final SmallMario instance = new SmallMario();

    public static SmallMario getInstance() {
        return instance;
    }

    @Override
    public State getName() {
        return State.SMALL;
    }

    @Override
    public void obtainMushRoom(MarioStateMachine stateMachine) {
        stateMachine.setCurrentState(SuperMario.getInstance());
        stateMachine.setScore(stateMachine.getScore() + 100);
    }

    @Override
    public void obtainCape(MarioStateMachine stateMachine) {
        stateMachine.setCurrentState(CapeMario.getInstance());
        stateMachine.setScore(stateMachine.getScore() + 200);
    }

    @Override
    public void obtainFireFlower(MarioStateMachine stateMachine) {
        stateMachine.setCurrentState(FireMario.getInstance());
        stateMachine.setScore(stateMachine.getScore() + 200);
    }

    @Override
    public void meetMonster(MarioStateMachine stateMachine) {
//        stateMachine.setCurrentState(FireMario.getInstance());
//        stateMachine.setScore(stateMachine.getScore() - 100);
    }
}
